<%@page trimDirectiveWhitespaces="true"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!-- If the captcha failed -->
<c:if test="${not empty command.rppsNumber}">
 <script type="text/javascript">
		$(function() {
			$('#rpps_number').val("${command.rppsNumber}");
			searchProfessional();
		});
	</script>
</c:if>
<c:if test="${empty command.rppsNumber}">
 <c:if test="${not empty command.adeliNumber}">
  <c:if test="${not empty command.postalCode}">
   <script type="text/javascript">
				$(function() {
					$('#adeli_number').val("${command.adeliNumber}");
					$('#postal_code').val("${command.postalCode}");
					searchProfessional();
				});
			</script>
  </c:if>
 </c:if>
</c:if>
<!-- Errors -->
<div id="errorRppsNumber" class="formCachedError">
 <spring:message code="error.rpps.number" />
</div>
<div id="errorAdeliNumber" class="formCachedError">
 <spring:message code="error.adeli.number" />
</div>
<div id="errorPostalCode" class="formCachedError">
 <spring:message code="error.postal.code" />
</div>
<div id="noProfessionalFound" class="formCachedError">
 <spring:message code="error.no.professional.found" />
</div>
<div id="errorRppsNumberFormat" class="formCachedError">
 <spring:message code="error.rpps.number.numeric" />
</div>
<div id="errorAdeliNumberFormat" class="formCachedError">
 <spring:message code="error.adeli.number.numeric" />
</div>
<div id="errorGettingInfos" class="formCachedError">
 <spring:message code="error.ldap.getting.informations" />
</div>
<!-- Loading screen -->
<div id="loadingScreen"></div>
<!-- Search form -->
<div id="professional_number">
 <!-- 1st line -->
 <div class="formColumn">
  <div class="formLabel">
   <label for="rpps_number"><spring:message code="label.rpps.number" /></label>
  </div>
  <div class="formField">
   <input type="text" name="rpps_number" id="rpps_number" maxlength="12" />
  </div>
 </div>
 <div class="formColumn">
  <div class="formLabel">
   <label for="adeli_number"><spring:message code="label.adeli.number" /></label>
  </div>
  <div class="formField">
   <input type="text" name="adeli_number" id="adeli_number" maxlength="10" />
  </div>
 </div>
 <!-- 2nd line -->
 <div class="formColumn">&nbsp;</div>
 <div class="formColumn">
  <div class="formLabel">
   <label for="postal_code"><spring:message code="label.postal.code" /></label>
  </div>
  <div class="formField">
   <input type="text" name="postal_code" id="postal_code" />
  </div>
 </div>
 <div>
  <input type="button" name="search_for_professional" id="search_for_professional" value="Valider" />
 </div>
</div>
<!-- Register form -->
<div id="user_datas" class="hidden">
 <c:if test="${not empty captchaError}">
  <div id="captchaError" class="formError">
   <spring:message code="error.captcha.invalid" />
  </div>
 </c:if>
 <div id="errorData" class="formCachedError">
  <spring:message code="error.field.error.begin" />
  "<span id="fieldName"></span>"
  <spring:message code="error.field.error.end" />
 </div>
 <div id="fieldError" class="formCachedError"></div>
 <div id="errorPasswordMatch" class="formCachedError">
  <spring:message code="error.password.match" />
 </div>
 <div id="errorPasswordTooShort" class="formCachedError">
  <spring:message code="error.password.too.short" />
 </div>
 <div id="errorMailRegex" class="formCachedError">
  <spring:message code="error.mail.regex" />
 </div>
 <div id="errorAddressUnknown" class="formCachedError">
  <spring:message code="error.address.unknown" />
 </div>
 <div id="errorList" class="formError">
  <c:forEach items="${errorList}" var="error">
   <spring:message code="${error}" />
   <br />
  </c:forEach>
 </div>
 <form:form method="post" action="../add/professional" commandName="register" class="withAddress">
  <!-- 1st line -->
  <tags:columnInputText label="label.login" id="username" mandatory="true" />
  <tags:columnInputText label="label.mail" id="mail" mandatory="true" />
  <!-- 2nd line -->
  <tags:columnInputPassword label="label.password" id="password" mandatory="true" />
  <tags:columnInputPassword label="label.password.confirm" id="passwordConfirm" mandatory="true" />
  <!-- 3rd line -->
  <tags:columnInputText label="label.rpps.number" id="rppsNumber" readonly="true" mandatory="true" />
  <tags:columnInputText label="label.adeli.number" id="adeliNumber" readonly="true" mandatory="true" />
  <!-- 4th line -->
  <tags:columnInputRadio label="label.gender" id="gender" items="${genderList}" mandatory="true" />
  <tags:columnInputSelect label="label.title" id="title" items="${titleList}" withEmpty="true" />
  <!-- 5th line -->
  <tags:columnInputText label="label.firstname" id="firstname" readonly="true" mandatory="true" />
  <tags:columnInputText label="label.lastname" id="lastname" readonly="true" mandatory="true" />
  <!-- 5th line -->
  <tags:columnInputText label="label.job" id="job" readonly="true" mandatory="true" />
  <tags:columnInputText label="label.speciality" id="speciality" readonly="true" />
  <!-- 7th line -->
  <tags:columnInputText label="label.corporate.name" id="corporateName" mandatory="true" />
  <div class="formColumn">&nbsp;</div>
  <!-- 7th line -->
  <tags:columnInputText label="label.postal.address" id="postalAddress" big="true" mandatory="true" />
  <!-- 8th line -->
  <tags:columnInputText label="label.post.office.box" id="postOfficeBox" />
  <tags:columnInputText label="label.department" id="departmentLabel" hiddenId="departmentCode"
   readonly="true" mandatory="true" />
  <div class="clear"></div>
  <!-- 9th line -->
  <tags:columnInputText label="label.postal.code" id="postalCode" readonly="true" mandatory="true" />
  <tags:columnInputText label="label.city" id="city" mandatory="true" />
  <!-- 10th line -->
  <tags:columnInputText label="label.business.phone" id="businessPhone" mandatory="true" />
  <tags:columnInputText label="label.gsm.phone" id="gsmPhone" />
  <!-- 11th line -->
  <tags:columnInputSelect label="label.agreement" id="agreement" items="${agreementList}"
   mandatory="true" big="true" />
  <!-- Last line before -->
  <c:if test="${recaptchaEnabled}">
   <tags:reCaptcha />
  </c:if>
  <form:hidden path="lat" />
  <form:hidden path="lng" />
  <div class="formBigColumn">
   <spring:message code="label.create.account" var="submit" />
   <input type="button" name="register_button" value="${submit}" id="register_button" />
  </div>
  <div class="clear"></div>
 </form:form>
</div>